1 using System;
2 using
System.ComponentModel;
3 using
System.Data;
4 using
System.Drawing;
5 using
System.Text;
6 using
System.Windows.Forms;
7 using
Telerik.WinControls;
8 using
System.Collections.Generic;
9
10 namespace
QuanLyNhanSu
11 {

12     ///
<summary>
13     ///
Base class that gives any form that derives from it the effect of slowly
14     ///
appearing and then disapperaing. Much like outlook email notification pop-ups
15     ///
</summary>
16     
public class TransDialog : RadForm//System.Windows.Forms.Form
17     {
18         
#region Constructor
19         
public TransDialog()
20         {
21             InitializeComponents();
22         }
23         
public TransDialog(bool disposeAtEnd)
24         {
25             m_bDisposeAtEnd = disposeAtEnd;
26             InitializeComponents();
27         }
28         
void InitializeComponents()
29         {
30             
this.components = new System.ComponentModel.Container();
31             
this.m_clock = new Timer(this.components);
32             
this.m_clock.Interval = 10;
33             
this.SuspendLayout();
34             
//m_clock
35             
this.m_clock.Tick += new EventHandler(Animate);
36             
//TransDialog
37             
this.Load += new EventHandler(TransDialog_Load);
38             
this.Closing += new CancelEventHandler(TransDialog_Closing);
39             
this.ResumeLayout(false);
40             
this.PerformLayout();
41         }
42         
#endregion
43
44         
#region Event handlers
45         
private void TransDialog_Load(object sender, EventArgs e)
46         {
47             
this.Opacity = 0.0;
48             m_bShowing =
true;
49
50             m_clock.Start();
51         }
52
53         
private void TransDialog_Closing(object sender, CancelEventArgs e)
54         {
55             
if (!m_bForceClose)
56             {
57                 m_origDialogResult =
this.DialogResult;
58                 e.Cancel =
true;
59                 m_bShowing =
false;
60                 m_clock.Start();
61             }
62             
else
63             {
64                 
this.DialogResult = m_origDialogResult;
65             }
66         }
67
68         
#endregion
69
70         
#region Private methods
71         
private void Animate(object sender, EventArgs e)
72         {
73             
if (m_bShowing)
74             {
75                 
if (this.Opacity < 1)
76                 {
77                     
this.Opacity += 0.01;
78                 }
79                 
else
80                 {
81                     m_clock.Stop();
82                 }
83             }
84             
else
85             {
86                 
if (this.Opacity > 0)
87                 {
88                     
this.Opacity -= 0.01;
89                 }
90                 
else
91                 {
92                     m_clock.Stop();
93                     m_bForceClose =
true;
94                     
this.Close();
95                     
if (m_bDisposeAtEnd)
96                         
this.Dispose();
97                 }
98             }
99         }
100
101         
#endregion
102
103         
#region overrides
104         
protected override void Dispose(bool disposing)
105         {
106             
if (disposing && (components != null))
107             {
108                 components.Dispose();
109             }
110             
base.Dispose(disposing);
111         }
112         
#endregion
113
114         
#region private variables
115         
private System.ComponentModel.IContainer components = null;
116         
private Timer m_clock;
117         
private bool m_bShowing = true;
118         
private bool m_bForceClose = false;
119         
private DialogResult m_origDialogResult;
120         
private bool m_bDisposeAtEnd = false;
121         
#endregion // private variables
122
123     }
124 }



Quản lý nhân sự công ty bằng c# _ full source code 60.390 lượt xem

Gõ tìm kiếm nhanh...